package ViewPropertyPanel;

import java.awt.event.ActionListener;

import javax.swing.Icon;
import javax.swing.JButton;

import drawPropertyCommands.GraphicsProperties;
import drawPropertyCommands.IDrawModifier;

public class DrawModifierButtons extends JButton{

    private static final long serialVersionUID = 1L;
    protected IDrawModifier modifier;
    
    public DrawModifierButtons(IDrawModifier modifier, String name, ActionListener al){
        super(name);
        initializeButton(modifier, name, al);
    }
    
    public DrawModifierButtons(IDrawModifier modifier, String name, ActionListener al, Icon icon){
        super(icon);
        initializeButton(modifier, name, al);
    }

    /**
     * @param name
     * @param al
     */
    protected void initializeButton(IDrawModifier modifier, String name, ActionListener al) {
        this.modifier = modifier;
        this.setActionCommand(name);
        this.addActionListener(al);
        this.setOpaque(true);
    }
    
    public void executeModify(GraphicsProperties gp){
        modifier.modify(gp);
    }
}
